<%--
  Created by IntelliJ IDEA.
  User: 29265
  Date: 2024/6/3
  Time: 17:52
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>单词库</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            background-color: #f2f2f2;
            margin: 0;
            padding: 0;
        }
        .container {
            max-width: 800px;
            margin: 20px auto;
            background-color: #fff;
            border-radius: 5px;
            padding: 20px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
        }
        h3 {
            color: #009688;
        }
        table {
            width: 100%;
            border-collapse: collapse;
            margin-top: 20px;
        }
        table, th, td {
            border: 1px solid #ddd;
        }
        th, td {
            padding: 12px;
            text-align: center;
        }
        tr:nth-child(even) {
            background-color: #f2f2f2;
        }
        .form-container {
            text-align: center;
            margin-bottom: 20px;
        }
        .form-container input[type="text"] {
            padding: 8px;
            margin: 0 5px;
        }
        .btn {
            padding: 10px 20px;
            background-color: #4CAF50;
            border: none;
            color: #fff;
            cursor: pointer;
            border-radius: 3px;
        }
        .btn:hover {
            background-color: #45a049;
        }
        .btn.reset {
            background-color: #f44336;
        }
        .btn.reset:hover {
            background-color: #d32f2f;
        }
        .action-links a {
            text-decoration: none;
            color: #039be5;
            margin-right: 10px;
        }
        .action-links a:hover {
            text-decoration: underline;
        }
    </style>
</head>
<body>
<div class="container">
    <h3>单词表</h3>
    <div class="form-container">
        <form method="post" action="WordListServlet">
            <h3>添加单词：</h3>
            <input type="hidden" name="operate" value="addWord">
            <p>单词：<input type="text" name="word">&nbsp;释义：<input type="text" name="definition">&nbsp;&nbsp;&nbsp;<input type="submit" class="btn" value="添加"/></p>
        </form>
        <form method="post" action="WordListServlet">
            <h3>查询条件：</h3>
            <p>单词：<input type="text" name="word">
                <input type="hidden" name="operate" value="search">
                <input type="submit" class="btn" value="查询">&nbsp;&nbsp;&nbsp;&nbsp;<input type="reset" class="btn reset" value="重置"/>
            </p>
        </form>
    </div>
    <table>
        <thead>
        <tr>
            <th>序号</th>
            <th>单词</th>
            <th>释义</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        <c:forEach items="${userDtoList}" var="user" varStatus="status">
            <tr>
                <td>${status.index + 1}</td>
                <td>${user.word}</td>
                <td>${user.definition}</td>
                <td class="action-links">
                    <a href="WordListServlet?&opsCode=delWord&word=${user.word}">删除</a>
                </td>
            </tr>
        </c:forEach>
        </tbody>
    </table>
</div>
</body>
</html>

